#ifndef FONT_H
#define FONT_H

#include "lib.h"

namespace Library
{

/**
 * A concrete base class that defines a font interface.
 */
class PLIBEXP Font
{
	public:
		struct Resource;

	public:
						Font();
		virtual			~Font();
	
		virtual	bool8	isLoaded();

		virtual int32	ascent();

		enum CharOffset { NOCHAR = -1 };
		virtual int32	charOffset(const uint16 ch);

		virtual int32	descent();

		virtual void	drawText(int32 * x, int32 y, const uint16* text, uint32 len, pCFrame frame);
		virtual void	drawText(int32 * x, int32 y, const uint16 ch, pCFrame frame);

		virtual void	drawText(int32 * x, int32 y, const uint16* text, uint32 len, pCBitmap bitmap);
		virtual void	drawText(int32 * x, int32 y, const uint16 ch, pCBitmap bitmap);

		virtual int32	externalLeading();

		virtual void	glyphMetric(int32 * width, int32 * height,
							int32 * left, int32 * right, int32 * top,
							int32 * bottom, const uint16 ch);
		virtual void	glyphMetric(int32 * width, int32 * height,
							int32 * left, int32 * right, int32 * top,
							int32 * bottom, const uint16* text, uint32 len);

		virtual bool8	isA(uint32 type);

		virtual uint32	kind();

		virtual int32	maximumGlyphHeight();
		virtual int32	maximumGlyphWidth();

		virtual int32	maximumTextHeight();
		virtual int32	maximumTextWidth();

		virtual void	textMetric(int32 * width, int32 * height, int32 * abcA,
							int32 * abcC, const uint16 ch);
		virtual void	textMetric(int32 * width, int32 * height, int32 * abcA,
							int32 * abcC, const uint16* text, uint32 len);

	// prohibited
	private:
		Font(Font &);
		Font & operator=(Font &);
};

/**
 * A base structure of all serializable fonts.
 */
struct Font::Resource
{
	/**
	 * The version of the serialized font where the high 16-bits are the major
	 * version and the low 16-bits are the minor version.  This version when
	 * used in conjunction with fontClass, determines the format of the
	 * data that immediately follows this structure.
	 */
	uint32	version;

	/**
	 * A unique number that specifies the serialized font class.  This number
	 * is typically used in a font factory to reconstruct the class.
	 */
	uint32	fontClass;
};

//----------------------------------------------------------------------------
// Documentation, prohibited methods (unimplemented)
//

/**
 * @fn Library::Font::Font(Font &)
 *
 * This method is reserved and unimplemented.  It has been defined for
 * Orthodox Canonical Form (OCF) compliance to prevent shallow object copies
 * from inadvertent use.
 */

/**
 * @fn Library::Font & Library::Font::operator=(Font &)
 *
 * This method is reserved and unimplemented.  It has been defined for
 * Orthodox Canonical Form (OCF) compliance to prevent shallow object copies
 * from inadvertent use.
 */

}; // namespace Library

#endif
